Websydian v6.1 online documentationOnline documentation - Websydian v6.5

Start Application Service on Java

To start an Application Service on the Java platform, an Application Service Listener function should be generated and built in addition to the Websydian application. See Implementing an Application Service Listener for further details.

Parameters to Application Service

When the Websydian program files have been deployed at the server location, the property file of the Application Service Listener function should be configured.  Per default, the file containing the settings for the entire application is named obXXXclient.properties where XXX is the CA Plex version (e.g. 500).

In addition to the standard entries, the following entries should be added as shown in the sample below:

HTML.WEBSYDIANSERVER_PORT               = 8189
HTML.WEBSYDIANSERVER_IPADDR             = 127.0.0.1
HTML.SERVICE_IPADDR                     = localhost
HTML.SERVICE_PORT                       = 11001
HTML.SERVICE_NAME                       = ProTestJava
HTML.AUTO_RECOVER                       = y
HTML.SOCKET_TIME_OUT                    = 0
HTML.TIME_TO_LIVE                       = 360
HTML.WEBSYDIANSERVER_CONNECTION_TIMEOUT = 30
HTML.HTTP_BODY_ENCODING                 = ISO-8859-1
Parameter Description
Websydian Server IP address The IP address of the machine where the Websydian Server is started.
Websydian Server port The TCP port on which the Websydian Server listens.
Application Service Token The Token that identifies the Application Service. The Token is expressed using URL notation:
  wsydwa://<host>:<port>/<service name>
Host
The IP address of the machine where the Application Service is started
Port
TCP port that the Application Service listens on.
Service Name
The name identifying the Websydian application this Application Service belongs to.

Examples:
  wsydwa://<default>:11001/WebDemo
  wsydwa://www.myhost.com:11001/myApplication
  wsydwa://127.0.0.1:4001/TEST

Time to live The time in seconds the Token is valid before it should be returned to the Application Service. A value of 0 means that the Token is valid forever.

If another party holds the Token while it times out it should be returned to the Application Service. When the Token is returned to the Application Service, the Application Service will resubmit the Token to the Websydian Server with a new time-out value.

Recover from error A value of 'N' will force the Application Service to shut down whenever an error occurs.

For the value 'Y' the Application Service will try to recover from simple errors such as an illegal packet or an error in the packet protocol.

Socket time out Time-out in seconds for read/write operations on the TCP socket.

The default value is 0 which means that the Application Service will not time-out on socket operations.

HTTPBodyEncoding When a request is received from the web server it will be encoded using a character encoding. If the character encoding is not specified with the request, then the encoding specified by this parameter will be used.

This parameter is also used to translate the response from the local character set to the character set expected by the browser, if no character set was specified by the application.

Example values:

  • ISO-8859-1 (Western Europe)
  • ISO-8859-2 (Eastern Europe)
Websydian Server Timeout When the Application Service is started it will connect to the Websydian Server to register itself as running.

If this connection fails (e.g. because the Websydian Server is not started), then the Application Service will wait the specified number of seconds before making another attempt to connect to the Websydian Server.

The Application Service will try 3 times before terminating if it is not possible to connect to the Websydian Server.

Start Application Service

The Application Service is started by calling the Java virtual machine with the following command:

java -cp obrun.jar;WsydDwa21.jar;<App> ObRun.ObPanel.ObLaunch WDwaSvc Path=<path>

<path> refers to the location of the property file obXXXclient.properties and WDwaSvc is the file name of the Application Service Listener function.
<App> is the location of the generated Websydian Application Java class files, e.g. c:\MyProjects\WebsydianJavaApp\Gen. Alternatively the entire application can be packed as a Jar file and then <App> should contain the full path to the Jar file.

If ObRun.jar and WsydDwa21.jar is not in the current folder, then specify the full path to those files when executing the command.

Remember to start the Websydian Server before starting the new Application Service. Otherwise the Application Service will fail to start when attempting to connect to the Websydian Server.

Multiple Application Services

To start multiple Application Services for the same Websydian application each instance of the Application Services must have its own obXXXclient.properties file. To do this create a separate folder for each Application Service and copy the obXXXclient.properties file to the folder. Then each Application Service can be started using the above command where only the Path parameter differs: 

java  -cp obrun.jar;WsydDwa21.jar ObRun.ObPanel.ObLaunch WdwaSvc Path=<path1>
java  -cp obrun.jar;WsydDwa21.jar ObRun.ObPanel.ObLaunch WdwaSvc Path=<path2>
...

An alternative method is to add parameters to the Application Service as command-line arguments. The command line arguments are added after the path definition. Please consult the Plex documentation for details on how to add input parameters to a Plex function as command-line arguments.

The sequence of the command-line arguments are as follows:

<Websydian Server IP> <Websydian Server port> <Websydian Server encoding> <IP> <port> <Service name> <Time to live> <Service URL> <Socket time out> <Recover> <Encoding>

Parameter Description
Websydian Server IP IP address of the machine where the Websydian Server is started
Websydian Server TCP TCP port that the Websydian Server listens on
Websydian Server encoding Encoding used when communicating with the Websydian Server
Websydian Server connection Time in seconds Application Service will wait before reconnecting to the Websydian Server
IP IP address of the Application Service Listener
Port TCP port used by the Application Service Listener
Service name Application Service Name
Time to live Token time to live
Service URL Alternative to the IP, Port, and Service name parameters. The syntax is "wsydwa://<IP>:<Port>/Service name"
Socket time out Time out on the socket connections
Recover Automatic recovery from minor errors (Y or N)
Encoding Encoding used for clients communicating with the Application Service
Default character set Default character set to use for requests/responses if the request/response is not associated with a character set.

Command-line parameters must be specified in the above sequence. If some of the trailing arguments are omitted the corresponding values will be read from the property file.

Example:

java -cp obrun.jar;WsydDwa21.jar ObRun.ObPanel.ObLaunch WdwaSvc Path=<path1> 127.0.0.1,8189," ",30,"<default>",11001,myApp,0," ",0,Y," ", "ISO-8859-1" ,[Environment]

The [Environment] indicate the environment to be used default is "Default" - See the Plex manual for further information.

The sequence " " is used to send a blank value (*Blank ).